package com.liu.learning.manual_paper.controller;

import com.liu.learning.manual_paper.dto.QuestionScoresDTO;
import com.liu.learning.manual_paper.service.PaperVoService;
import com.liu.learning.manual_paper.service.SetScoreService;
import com.our.learning.infrastructure.pojo.Response;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/manual_scores")
public class SetScoreController {
    private final SetScoreService setScoreService;

    private final PaperVoService paperVoService;
    public SetScoreController(SetScoreService setScoreService, PaperVoService paperVoService) {
        this.setScoreService = setScoreService;
        this.paperVoService = paperVoService;
    }

    @GetMapping("/paper_list")
    public Response paperList(Integer page, Integer perPage, Integer id , Integer sumScore){
        return paperVoService.paperList(page,perPage,id,sumScore);
    }

//    @GetMapping("/{id}")
//    public Response getPaper(@PathVariable Integer id){
//        return setScoreService.getPaper(id);
//    }
    @GetMapping("/question_list/{id}")
    public Response questionList(@PathVariable Integer id){
        return setScoreService.questionList(id);
    }
//    @PutMapping
//    public Response setScore(@RequestBody PaperScoresDTO paperScoresDTO) {
//        return setScoreService.setScores(paperScoresDTO);
//    }
    @PutMapping("/set_score/{id}")
    public Response setScore(@RequestBody QuestionScoresDTO questionScoresDTO, @PathVariable Integer id) {
        return setScoreService.setScores(questionScoresDTO,id);
    }
    @DeleteMapping("/{id}")
    public Response deletePaper(@PathVariable Integer id) {
        return setScoreService.deletePaper(id);
    }
}
